from typing import Optional
from pydantic import BaseModel, Field


class TranscriptBase(BaseModel):
    """转录文本基础模型"""
    text: str = Field(..., min_length=1)
    speaker: Optional[str] = None
    timestamp: float = Field(..., ge=0)
    confidence: Optional[float] = Field(None, ge=0, le=1)
    language: Optional[str] = None


class TranscriptCreate(TranscriptBase):
    """创建转录文本请求模型"""
    meeting_id: int


class Transcript(TranscriptBase):
    """转录文本响应模型"""
    id: int
    meeting_id: int

    class Config:
        from_attributes = True


class TranscriptBatch(BaseModel):
    """批量转录文本模型"""
    transcripts: list[TranscriptCreate]